export enum LanguageType {
    en_US,
    zh_CN,
    ru_RF
}

// const languageMaps: string[] = [];
// languageMaps[LanguageType.en_US] = "en_US";
// languageMaps[LanguageType.zh_CN] = "zh_CN";
// languageMaps[LanguageType.ru_RF] = "ru_RF";

export let language: LanguageType = LanguageType.zh_CN;
export function setLanguage(value: LanguageType): void {
    language = value;
}
export function setLanguageByString(value: string) {
    value = value.replace("-", "_");
    language = LanguageType[value as any] as any;
}

export function get(languages: string[] | any, ...args: (number | string)[]): string {
    let result: string;
    if (languages instanceof Array) {
        if (language < languages.length) {
            result = languages[language];
        }
        else {
            result = languages[LanguageType.en_US];
        }
    }
    else {
        result = languages[LanguageType[language]];
    }

    if (args.length > 0) {
        for (let i = 0, l = args.length; i < l; ++i) {
            result = result.replace("{" + i + "}", args[i] as string);
        }
    }

    return result;
}

export const Layout = {
    title: {
        history: [
            "History",
            "历史记录"
        ],
        outline: [
            "Outline",
            "预览"
        ],
        welcome: [
            "Welcome",
            "欢迎页"
        ],
        document: [
            "NewDocument_{0}",
            "新文档_{0}"
        ],
        library: [
            "Library",
            "库"
        ],
        scene: [
            "Scene",
            "场景"
        ],
        zOrder: [
            "ZOrder",
            "层级"
        ],
        property: [
            "Property",
            "属性"
        ],
        color: [
            "Color",
            "颜色"
        ],
        animation: [
            "Animation",
            "动画"
        ],
        timeline: [
            "Timeline",
            "时间轴"
        ],
        curve: [
            "Curve",
            "曲线"
        ]
    }
};

export const TopMenu = {
    dragonBones: {
        newDocument: [
            "New Document",
            "新建文档"
        ],
        openDocument: [
            "Open Document",
            "打开文档"
        ]
    }
};